$ From Appendix B of Brinch Hansen On Pascal Compilers
$ This file contains invalid tokens for testing purposes
$ PL Program: Linear Search
# Non comment
%% Same Here
begin
	$ invalid integer
	const n = 10a; integer array A[n];

	$ invalid word
	integer _x, i; Boolean found;
	
	proc Search
	begin integer m;
		i, m := 1, n;
		do i <m ->
			if A[i] = x -> m := i;[]
				~(A[i] = x) -> i := i + 1;
			fi;
		od;
		found := A[i] = x;
	end;

	$Input Table:
	i:=1;
	do ~(i>n) -> read A[i]; i:=i+1; od;
	$Test Search:
	read x;
	do ~(X = 0) ->
		call Search;
		if found -> write x, i; []
			~found -> write x;
		fi;
		read x;
	od;
end.
